package codeGen.core.model;

import codeGen.core.BeanUtil;

public class FieldModel {
    private String name;
    private String toMethodName;
    private String toLabelName;
    private String sqlType = "varchar";
    private String javaType = "string";
    private String dwzType = "";
    private Boolean isPrimtive = false;
    private Boolean isAutoIncrease = false;
    private Boolean isForeignKey = false;
    private Object defaultValue;
    private Boolean isNull = true;
    private String comment = "";// 注释

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSqlType() {
        return sqlType;
    }

    public void setSqlType(String sqlType) {
        this.sqlType = sqlType;
    }

    public String getJavaType() {
        return javaType;
    }

    public void setJavaType(String javaType) {
        this.javaType = javaType;
    }

    public String getDwzType() {
        return dwzType;
    }

    public void setDwzType(String dwzType) {
        this.dwzType = dwzType;
    }

    public Boolean getIsPrimtive() {
        return isPrimtive;
    }

    public void setIsPrimtive(Boolean isPrimtive) {
        this.isPrimtive = isPrimtive;
    }

    public Boolean getIsAutoIncrease() {
        return isAutoIncrease;
    }

    public void setIsAutoIncrease(Boolean isAutoIncrease) {
        this.isAutoIncrease = isAutoIncrease;
    }

    public Boolean getIsForeignKey() {
        return isForeignKey;
    }

    public void setIsForeignKey(Boolean isForeignKey) {
        this.isForeignKey = isForeignKey;
    }

    public Object getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(Object defaultValue) {
        this.defaultValue = defaultValue;
    }

    public String getToMethodName() {
        return toMethodName;
    }

    public void setToMethodName(String toMethodName) {
        this.toMethodName = toMethodName;
    }

    public Boolean getIsNull() {
        return isNull;
    }

    public void setIsNull(Boolean isNull) {
        this.isNull = isNull;
    }

    public String getToLabelName() {
        return toLabelName;
    }

    public void setToLabelName(String toLabelName) {
        this.toLabelName = toLabelName;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public FieldModel(String name, String toMethodName, String toLabelName,
                      String sqlType, Boolean isPrimtive, Boolean isAutoIncrease,
                      Boolean isForeignKey, Object defaultValue, Boolean isNull) {
        this.name = name;
        this.toMethodName = toMethodName;
        this.toLabelName = toLabelName;
        this.sqlType = sqlType;
        this.javaType = BeanUtil.toJavaType(sqlType);
        this.dwzType = BeanUtil.toDwzValidateClass(this.javaType);
        this.isPrimtive = isPrimtive;
        this.isAutoIncrease = isAutoIncrease;
        this.isForeignKey = isForeignKey;
        this.defaultValue = defaultValue;
        this.isNull = isNull;
    }

    public FieldModel(String name, String toMethodName, String toLabelName,
                      String sqlType, Boolean isPrimtive, Boolean isAutoIncrease,
                      Boolean isForeignKey, Object defaultValue, Boolean isNull, String comment) {
        this(name, toMethodName, toLabelName, sqlType, isPrimtive, isAutoIncrease, isForeignKey, defaultValue, isNull);
        this.comment = comment;
    }

}
